home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
MATHS
/
ARCAUT
/
Automatons
/
GenDrift
< prev
next >
Wrap
Text File
|
1991-07-27
|
1KB
|
46 lines
AUTOMATON*
Genetic_Drift
Using the Moore neighbourhood, this represents a naive approach to particle
diffusion. Each cell is replaced by one of it's eight neighbours which is
randomly chosen. A little thought though, shows that the number of
particles of each state is not preserved; some cells are forgotten by the
following generation, others are duplicated within several neighbouring
cells. However this process does bare some relation to reality; imagine
each cell chooses one of it's eight neighbours as a parent. It then
inherits the genes (cell state) of that cell at the next generation. The
resulting patterns of colour which spread across the screen illustrate how
this genetic information moves in space as the generations proceed.
Compare with 'Brownian Motion'.
INITIALISATION*
10DEF PROCdo
20*SetEval wrap on
30ENDPROC
SCREEN*
10DEF PROCdo
20DIM buf% 256:SYS "OS_ReadVarVal","sux",buf%,256
30a%=!buf%:r%=.8*a%
40GCOL 63:CIRCLE FILL a%,a%,r%
50GCOL 48:CIRCLE FILL -a%,a%,r%
60GCOL 12:CIRCLE FILL a%,-a%,r%
70GCOL 3:CIRCLE FILL -a%,-a%,r%
80ENDPROC
CODE*
( READ_NEIG 8RND
DUP 0 = IF (TM ==)
DUP 1 = IF (BM ==)
DUP 2 = IF (ML ==)
DUP 3 = IF (TL ==)
DUP 4 = IF (TR ==)
DUP 5 = IF (BL ==)
6 = IF (BR ==)
MR == )
END*